<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../style.css" type="text/css" media="screen">
<link rel="stylesheet" href="../../../print.css" type="text/css" media="print">
<meta content="LocaleManager,com.nunorosa.locale.LocaleManager,language,autoUpdate,addXMLPath,getInstance,getString,initialize,registerComponent,setLang,unregisterComponent" name="keywords">
<title>com.nunorosa.locale.LocaleManager</title>
</head>
<body>
<script type="text/javascript" language="javascript" src="../../../asdoc.js"></script><script type="text/javascript" language="javascript" src="../../../cookies.js"></script><script type="text/javascript" language="javascript">
<!--
				asdocTitle = 'LocaleManager - API Documentation';
				var baseRef = '../../../';
				window.onload = configPage;
			--></script>
<table style="display:none" id="titleTable" cellspacing="0" cellpadding="0" class="titleTable">
<tr>
<td align="left" class="titleTableTitle">Locale</td><td align="right" class="titleTableTopNav"><a onclick="loadClassListFrame('../../../all-classes.html')" href="../../../package-summary.html">All&nbsp;Packages</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../../all-classes.html')" href="../../../class-summary.html">All&nbsp;Classes</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../../index-list.html')" href="../../../all-index-A.html">Index</a>&nbsp;|&nbsp;<a href="../../../index.html?com/nunorosa/locale/LocaleManager.html&amp;com/nunorosa/locale/class-list.html" id="framesLink1">Frames</a><a onclick="parent.location=document.location" href="" style="display:none" id="noFramesLink1">No&nbsp;Frames</a></td><td rowspan="3" align="right" class="titleTableLogo"><img alt="Adobe Logo" title="Adobe Logo" class="logoImage" src="../../../images/logo.jpg"></td>
</tr>
<tr class="titleTableRow2">
<td align="left" id="subTitle" class="titleTableSubTitle">Class&nbsp;LocaleManager</td><td align="right" id="subNav" class="titleTableSubNav"><a href="#propertySummary">Properties</a>&nbsp;| <a href="#methodSummary">Methods</a></td>
</tr>
<tr class="titleTableRow3">
<td colspan="2">&nbsp;</td>
</tr>
</table>
<script type="text/javascript" language="javascript">
<!--
if (!isEclipse() || window.name != ECLIPSE_FRAME_NAME) {titleBar_setSubTitle("Class LocaleManager"); titleBar_setSubNav(false,true,false,false,false,false,true,false,false,false,false,false,false,false);}
--></script>
<div class="MainContent">
<table cellspacing="0" cellpadding="0" class="classHeaderTable">
<tr>
<td class="classHeaderTableLabel">Package</td><td><a onclick="javascript:loadClassListFrame('class-list.html')" href="package-detail.html">com.nunorosa.locale</a></td>
</tr>
<tr>
<td class="classHeaderTableLabel">Class</td><td class="classSignature">public class LocaleManager</td>
</tr>
<tr>
<td class="classHeaderTableLabel">Inheritance</td><td class="inheritanceList">LocaleManager <img class="inheritArrow" alt="Inheritance" title="Inheritance" src="../../../images/inherit-arrow.gif"> flash.events.EventDispatcher</td>
</tr>
</table>
<p></p>
  The com.nunorosa.locale.LocaleManager class allows you to easealy manage multilanguage applications.
  
  <p>It's works similar to the <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/fl/lang/package-detail.html">fl.lang</a> package but with a singleton pattern instead a static class, for example the language file (XML) must also use the XML Localization Interchange File Format (XLIFF).</p>
    <p></p>
<p>
<span class="classHeaderTableLabel">See also</span>
</p>
<div class="seeAlso">
<a href="http://en.wikipedia.org/wiki/Singleton_pattern" target="mm_external">Singleton Pattern</a>
</div>
<br>
<hr>
</div>
<a name="propertySummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Properties</div>
<table id="summaryTableProperty" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Property</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#autoUpdate">autoUpdate</a> : Boolean<div class="summaryTableDescription">
   Determines whether registered components are notified after loading XML file.</div>
</td><td class="summaryTableOwnerCol">LocaleManager</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#language">language</a> : String<div class="summaryTableDescription">[read-only]
   Returns the current language code.</div>
</td><td class="summaryTableOwnerCol">LocaleManager</td>
</tr>
</table>
</div>
<a name="methodSummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Methods</div>
<table id="summaryTableMethod" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#addXMLPath()">addXMLPath</a>(langCode:String, path:String):void</div>
<div class="summaryTableDescription">
   Adds the {languageCode and languagePath} pair into the internal array for later use.</div>
</td><td class="summaryTableOwnerCol">LocaleManager</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#getInstance()">getInstance</a>():<a href="../locale/LocaleManager.html">LocaleManager</a>
</div>
<div class="summaryTableDescription">[static]
   Instantiates and/or returns the reference to the LocaleManager instance.</div>
</td><td class="summaryTableOwnerCol">LocaleManager</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#getString()">getString</a>(id:String):String</div>
<div class="summaryTableDescription">
   eturns the string value associated with the given string ID in the current language.</div>
</td><td class="summaryTableOwnerCol">LocaleManager</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#initialize()">initialize</a>():void</div>
<div class="summaryTableDescription">
   Use this method to load the default system language.</div>
</td><td class="summaryTableOwnerCol">LocaleManager</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#registerComponent()">registerComponent</a>(c:<a href="ui/ILocaleComponent.html">ILocaleComponent</a>):Boolean</div>
<div class="summaryTableDescription">
   Register a multilanguage component to be notified when the language is changed.</div>
</td><td class="summaryTableOwnerCol">LocaleManager</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#setLang()">setLang</a>(langCode:String):void</div>
<div class="summaryTableDescription">
   Load the XML file corresponding to the language code.</div>
</td><td class="summaryTableOwnerCol">LocaleManager</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#unregisterComponent()">unregisterComponent</a>(c:<a href="ui/ILocaleComponent.html">ILocaleComponent</a>):Boolean</div>
<div class="summaryTableDescription">
   Unregister a multilanguage component to stop receiving language notifications.</div>
</td><td class="summaryTableOwnerCol">LocaleManager</td>
</tr>
</table>
</div>
<script type="text/javascript" language="javascript">
<!--
showHideInherited();
--></script>
<div class="MainContent">
<a name="propertyDetail"></a>
<div class="detailSectionHeader">Property detail</div>
<a name="autoUpdate"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">autoUpdate</td><td class="detailHeaderType">property</td>
</tr>
</table>
<div class="detailBody">
<code>autoUpdate:Boolean</code>&nbsp;&nbsp;[read-write]<p>
   Determines whether registered components are notified after loading XML file.
   
   </p><p>The default value is <code>true</code>.</p>
<span class="label">Implementation</span>
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;public function get autoUpdate():Boolean</code>
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;public function set autoUpdate(value:Boolean):void</code>
<br>
</div>
<a name="language"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">language</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>language:String</code>&nbsp;&nbsp;[read-only]<p>
   Returns the current language code.
   
   </p><p>When the instance is created this property has the system default value.<br>
   System languages codes can be seen in the <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/system/Capabilities.html#language">flash.system.Capabilities</a> documentation.</p>
   <span class="label">Implementation</span>
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;public function get language():String</code>
<br>
</div>
<a name="methodDetail"></a>
<div class="detailSectionHeader">Method detail</div>
<a name="addXMLPath()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">addXMLPath</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td>
</tr>
</table>
<div class="detailBody">
<code>public function addXMLPath(langCode:String, path:String):void</code><p>
   Adds the {languageCode and languagePath} pair into the internal array for later use.
   
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">langCode</span>:String</code> &mdash; The language code.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">path</span>:String</code> &mdash;  The XML path to add. 
   </td>
</tr>
</table>
</div>
<a name="getInstance()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">getInstance</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static function getInstance():<a href="../locale/LocaleManager.html">LocaleManager</a></code><p>
   Instantiates and/or returns the reference to the LocaleManager instance.
   
   </p><p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code><a href="../locale/LocaleManager.html">LocaleManager</a></code> &mdash; 
                        LocaleManager instance reference.
   
                        
                     </td>
</tr>
</table>
<br>
<span class="label">Example</span>
<br>how to get a reference to the LocalManager
   <div class='listing'><pre>
   var locale:LocalManager = LocalManager.getInstance();
   trace(locale.autoUpdate); //true
   </pre></div>
   <p></p>
</div>
<a name="getString()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">getString</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function getString(id:String):String</code><p>
   eturns the string value associated with the given string ID in the current language.
   
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">id</span>:String</code> &mdash; ID defined in the XML file.
   </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>String</code></td>
</tr>
</table>
</div>
<a name="initialize()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">initialize</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function initialize():void</code><p>
   Use this method to load the default system language.
   
   <b>Note:</b> Make sure you associate a language file (XML) with the correct language code.
   </p><p>
<span class="label">See also</span>
</p>
<div class="seeAlso">
<a href="../locale/LocaleManager.html#addXMLPath()" target="">addXMLPath()</a>
<br>
<a href="http://livedocs.adobe.com/flex/201/langref/flash/system/Capabilities.html#language" target="mm_external">System language codes</a>
</div>
<br>
<span class="label">Example</span>
<br>   <div class='listing'><pre>
   var locale:LocaleManager = LocaleManager.getInstance();
   locale.addXMLPath("en","langFile_en.xml");
   locale.initialize();
   </pre></div>
   <p></p>
</div>
<a name="registerComponent()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">registerComponent</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function registerComponent(c:<a href="ui/ILocaleComponent.html">ILocaleComponent</a>):Boolean</code><p>
   Register a multilanguage component to be notified when the language is changed.
   
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">c</span>:<a href="ui/ILocaleComponent.html">ILocaleComponent</a></code> &mdash; The component, i.e., any object implementing the ILocaleComponent interface.
   </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Boolean</code></td>
</tr>
</table>
<p>
<span class="label">See also</span>
</p>
<div class="seeAlso">
<a href="ui/ILocaleComponent.html" target="">com.nunorosa.locale.ui.ILocaleComponent</a>
</div>
</div>
<a name="setLang()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">setLang</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function setLang(langCode:String):void</code><p>
   Load the XML file corresponding to the language code.
   
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">langCode</span>:String</code> &mdash; The language code.
   </td>
</tr>
</table>
<p>
<span class="label">See also</span>
</p>
<div class="seeAlso">
<a href="../locale/LocaleManager.html#addXMLPath()" target="">addXMLPath()</a>
</div>
<br>
<span class="label">Example</span>
<br>   <div class='listing'><pre>
   LocalManager.getInstance().setLang("pt");
   </pre></div>
   <p></p>
</div>
<a name="unregisterComponent()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">unregisterComponent</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function unregisterComponent(c:<a href="ui/ILocaleComponent.html">ILocaleComponent</a>):Boolean</code><p>
   Unregister a multilanguage component to stop receiving language notifications.
   
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">c</span>:<a href="ui/ILocaleComponent.html">ILocaleComponent</a></code> &mdash; The component, i.e., any object implementing the ILocaleComponent interface.
   </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Boolean</code></td>
</tr>
</table>
<p>
<span class="label">See also</span>
</p>
<div class="seeAlso">
<a href="ui/ILocaleComponent.html" target="">com.nunorosa.locale.ui.ILocaleComponent</a>
</div>
</div>
<br>
<br>
<hr>
<br>
<p></p>
<center class="copyright"> 
</center>
</div>
</body>
</html>
<!-- -->
